<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="active" id="demo" name="user" myAttr="agsdf">

    </div>
    <script>
        var boxEle = document.querySelector("div");
        var res = boxEle.attributes ;
        console.log(typeof res);
        // 0: class
        // 1: id
        // 2: name
        // 3: myattr
        // class: class
        // id: id
        // myattr: myattr
        // name: name
        // length: 4
        // [[Prototype]]: NamedNodeMap

    </script>
</body>
</html>